package com.hsh.erp.enums;

import org.apache.logging.log4j.util.Strings;

/**
 * 文件读取和写入的枚举类
 */
public enum ExpressEnum {

    NULL("", ""),
    YDGJ("韵达国际", "ydgj"),
    YTGJ("圆通国际", "ytgj"),
    YTGN("圆通国内", "ytgn");

    /**
     * 店铺名称
     */
    private final String name;

    /**
     * 店铺缩写
     */
    private final String simpleName;


    public String getName() {
        return name;
    }

    public String getSimpleName() {
        return simpleName;
    }


    ExpressEnum(String name, String simpleName) {
        this.name = name;
        this.simpleName = simpleName;
    }

    /**
     * 根据 缩写 获得 枚举对象
     *
     * @param simpleName
     * @return
     */
    public static ExpressEnum getBySimple(String simpleName) {
        if (Strings.isBlank(simpleName)) {
            return ExpressEnum.NULL;
        }
        for (ExpressEnum shopEnum : ExpressEnum.values()) {
            if (simpleName.equals(shopEnum.getSimpleName())) {
                return shopEnum;
            }
        }
        return ExpressEnum.NULL;

    }

    /**
     * 根据 缩写 获得 全称
     *
     * @param simpleName
     * @return
     */
    public static String getNameBySimple(String simpleName) {
        return getBySimple(simpleName).getName();

    }

}
